package greedyAlgorithm;

public class lengthOfLongestSubstring {
    public static int lengthOfLongestSubstring(String s) {
           char[] S=s.toCharArray();
           int[] hash=new int[128];
           int n=s.length();
           int left=0;
           int right=0;
           int ret=0;
        while (right<n){
            hash[S[right]]++;//进窗口
            //判断
            while (hash[S[right]]>1){
                hash[S[left++]]--;//出窗口
            }
            ret=Math.max(ret,right-left+1);
            right++;
        }
        return ret;
    }

    public static void main(String[] args) {
        String s="abcabcbb";
        int a=5/2;
        System.out.println(13%a);
        System.out.println(lengthOfLongestSubstring(s));
    }
}
